﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using static CommTest.TopicAddDto;

namespace CommTest
{
    public class AutoPublishTopic
    {
        static string baseUrl= "https://ccc.sxkid.com:5001";
        static string baseUrl2 = "https://m3.sxkid.com/";
        //15521034085 沉醉
        static string cookie = "uuid=1e485e15-88a2-45bb-91be-5b741e7e1883; ssxmod_itna=7qfxgDB7D=0=d4Bc4eTmzFqGQYDQdkzzFehHDlhPxA5D8D6DQeGTr0izr+kezY=igq0QHYQCD3eqFAS7RKk9GRqcYq+DB3DEx06hkUGPiinDCeDIDWeDiDGR7D=xGY9Dm4i7DYqiODzLdyDGfBDYP9QqDg0qDBCOdDKqGg7kU6bmNYxGUhIw437qDMmeGXYGWN7w2bNcw4r2QVlqGuDG=/7qGmS4bDCOvI97hYnEwYK4p=AAxN9YhNm7hhY7wAK7D1A0xvrDx3Dg4+qyqDGSkd/l+KeD; ssxmod_itna2=7qfxgDB7D=0=d4Bc4eTmzFqGQYDQdkzzFehD61b6OD0HTuK03KjRDuQGiin4n4pkRlobKpKV3bC92mWKUhGrmDZQmRDwq/rxxnKTVOB37jVmblOysdUt9ja+4kKyIg2edwmRTghEn9b8c+b5Z58knFTzxeTk2yafhe7/ABFA=546eAw6Yeiq+776OpO62ebbrrEYZ9CNfffMopH=r2kfZAaO6AQScRfRASwRG8dp3QPz3waYCq0BQYRn1aR5NeXkPyCkC=rPLCCN6rysH8gkYnkkagTRzK7pfENN0jrZnBTjRpq9kFwm3Q/YxKEFWgKui3jMKNhH3u5qA=FS520Yb8TfgK6oxo47y7QyDQU7q=iYsBzeRKq7s7OQLlNyRH1SKbomqR5yBwR0dkGNDLNPo1DkKaoQBO+xwpFrzDddYcd3bTzEWZi3KT=q4QKe7=qI/3QicYNLbe7KFoe=GDy+=qhDXmNUDNx2+Ddi7oQWSHQR7I1iZr=87OsLviLbhgT38NZokzSTD3QqBXpOdYGbEqRQ3I=Ox91t68YpOzVcYz0PKKWBMUsk=nusNfNf8xvDDw2DpxoR2eYjTHejkE31IAvxEx7DzaxOAhkdXjCqb7mn6fsUuxnlkBp3X5LmYAUxzgjPnM26GubU1UCw7Di4qCBZEHZ9erv84UIzz8D0WZhVeensOQD14qYGKDDFqDeuqtKQADtItAkBwABvnIahDzKbBq/ozD7nebGP3tPmxgq8Sv4vzfdi4bY6/EiRw9DxD===; ipCityCode=620100; ipCityName=%E5%85%B0%E5%B7%9E; UM_distinctid=1735a9605525e9-0d3acf4e8dbca4-4353760-144000-1735a960553bae; Hm_lvt_6b8e540f04115903f86565be32c3d914=1597041992; iSchoolAuth=CfDJ8A3fTXA7dahOp7dzX7udrT2X5lkcKZD3kvQUxj1fKPaUtpe2iSvECaS8AN4vcn_5-eQ1ja3oMoCSranY_e2bx24nYwuPhPxLhwr4gv7ZOSMhYYd08zG_pT8urcFwt-NA2-mtEVHVJ6xisckTIDc7RiqB15AXH7X5nkdQl-KYV5bSEWtRyTaFT6f923ErcJ0CKJmeTf-vtVUCSfFCA0SYqojcW3OnkIycCG1Ub3z_iuDFS658vyMBEPkqp9Rme6bGaU07fVeLFIRmQwYkvQu1XAqC899bZZpmjODOlB9NXaAMSW0fBqTj9HsyQmkhczg5JPS9SCwTr3FXafG_9774i-gqqOOMRmIkbPf_3_4PCPdvTzkSqB2--evo1xUpvy0X49hrM5-8KTVQw8VRlwyeH1lw3Sfw3ehmPjJ92EWdE0poahs9L_s3FLw5w8e1h3Cui3bZZe5loDUEGAD2TlkvxviVbcxDcbczGq6XsfjfGD0tCmFxVh2e_cpJ8B4qfp7fpLmlMaGMVt6TcZQ5kEhUopDWVc49C6dD-u8tiFcL36BU6O8dGG6HJGyAcmw0ppOmTA; Hm_lpvt_6b8e540f04115903f86565be32c3d914=1597285472";
        //15521034082 lion
        static string cookie2 = "uuid=9a6e9024-2096-4ef0-bdcc-4406e9ad498b; cityCode=620100; cityName=%E5%85%B0%E5%B7%9E; Hm_lvt_6b8e540f04115903f86565be32c3d914=1597064665; sessionid=160d2ce5-7839-4822-83b1-94e53be907ea; Hm_lpvt_6b8e540f04115903f86565be32c3d914=1597983255; iSchoolAuth=CfDJ8A3fTXA7dahOp7dzX7udrT3gyexHN4LpbPFXBpe8JDlxCWfzl2CpKzUTV__6ncY2QbrWf9hu8cJi42MRiZ0zM5rG4ZF-T-d_dkArfk1kAsq-WgZw0ifJ_BjLWnFTpFI7-lyb41nESlPD3ryIqt-76JEePEf4sqPT7h0k8Fjw5yVuDqz9yxISrhLYQRF57Sh6DZnVqFvxkep8vKOpoRyX6aKEhC8zKfvA85FnP_dqJhkMdltZGRb-8o3gXeeax3AittfiJzehFIWYi_a5LKa5DTvoSUYAiXjU3uLwgdvHWkPO-4FeBbakz-6VpTjj1OgYQIscQv0IFKRvn0DG3F5745SXqAWrJPfSA44syJgj3yO6PeLSW7dJITGjU6AqLYvuNt53628Lx0ORXT_9CwTk60YdWZ9B5mipKDNxmK0V0VJHJ7Yx4vggpiQUObULyqKGIpYJj3vEP-yw8QHuup-ePmgvk02X71G0WgNGvKwP_YavmSxhsee7qqShxcOo3MuIgpPMVrK9y1tXG4woYF8loJfrLDSrW6oGAWuN00HL6Hyaf7VWzlA1mtuRXXGpjB1R2F6oBcu2hqRehcFM4f9sv5bxUvov7WbEbxoM9yw8I91t6BP_Jlxdg24zBAdahSBXcWzjBooGXzX0vvjlcBl2mnoKKPftmOR2pi8w__OOPm5pXdBIc10b6I7cnOwb2ce4Wp9C35t8m2XuYWL9Hzqctb0";
        //15521034084 程心
        static string cookie3 = "uuid=9a6e9024-2096-4ef0-bdcc-4406e9ad498b; cityCode=620100; cityName=%E5%85%B0%E5%B7%9E; Hm_lvt_6b8e540f04115903f86565be32c3d914=1597064665; sessionid=160d2ce5-7839-4822-83b1-94e53be907ea; iSchoolAuth=CfDJ8A3fTXA7dahOp7dzX7udrT37RLObhuEuGcP2he0HhaBGRbqHj3mbrJ6EaAAXQJhvFF1GEWcNnUVAGhg6ye2D8poZYvemS8385hDeCvY08T-Q4SRp2yHeMvTUI6Ht8tcMXS0F_TUcjY61F836tYKtpcvFoEo5k8Jb_0tNQ471Gb_Q33i-G5WUzciYvp_r_Ls71_9V6S_HJV7mVGmPKgHwaWS-T0C887hFi8Q9Km77toAWeveu0r26MNueKSYxRvwTXiO5lGCU-79yumUTLWnMowZht5OjOkiTbQ-DR_MBj1SopiZYmfBRcKxgK95CAYhFSGeLDLD4pwz23ApLUv1k3dUcA3WMGQDZIAcqYyCrv2RSfIxfSTlb7jN4uzB1bMnoMackeJQdMTehcd-xn9DY0PPLnDtocPkiSbGoGIfjsz2fdcswApzBbaT3mF9Ej1uaIjhNE8MtBKFsEpuiSomm6z-CFMXpPQtam4s6SxF3aL0dzYHpQmzGj_488Eqt3iDunXFpfpNKSYlUnJDWGSUMMF22hvaQKmKQxLu6Y6OXRHcmBV3d-UB5b5-dF8Yj3j6eeALrWkk2WurWzGHCpTAEB-bAiJIuz0PLti-crsgRk0wXEUmcC_CKv-4NbFmlXTeEP6OPyUZvDLdzgCOGYjTwrTe3FEmI7uG8Apkr1E7mQEG8CimrcCFNHpk45LWnwR_UZQ_kkY4JQXRBHYXTsrEeXxs; Hm_lpvt_6b8e540f04115903f86565be32c3d914=1597983359";

        static string[] Cookies = new string[] { cookie, cookie2, cookie3 };

        public static void Build()
        {
            try
            {
                MakeCircleFans();
                //MakeTopic();a
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }

        public static void MakeCircleFans()
        {
            var circleId = Guid.Parse("14178988-c5fb-4c9b-9981-48dd23dbbecf");
            var userIdStr = "[\"5A6DC97A-6497-438B-96BF-0000064130A9\",\"0E557B5C-66D7-44B0-B5C6-0000067115A6\",\"05B0FF5D-7DF9-4A47-89D7-00002B41619B\",\"0B752AFB-A0B2-4B81-8F6C-000039DBF626\",\"6C0DE06F-C548-4555-B276-00004E7BBEAC\",\"8556D6CB-7A90-48C0-99BD-0000695D0B23\",\"94C4C284-9E22-42AA-BEA5-00007E873DB3\",\"46074F15-4419-46BE-BA51-00009249C2D8\",\"D2322D91-C188-4C06-9982-0000A5BEB765\",\"0A4E4D92-D6DB-4510-9EED-0000C4A15FA6\",\"A369EE2E-0BFD-42DA-863A-0000DD734FEB\",\"9955C68B-C3A9-40AA-AC47-000119D5F8EF\",\"34327522-A04B-4600-8974-000125B9CCA7\",\"529E715D-1D4C-4EE7-9D95-00014F7729F7\",\"9DF8BDA1-F619-4077-BD19-0001559CB60D\",\"A74014A1-E6A7-473E-9DA4-0001685BB956\",\"F9206A85-DDF4-4AB5-9CEB-00018586A13F\",\"0C4C944A-98E0-4880-ACD0-00018C4DBBFB\",\"29402954-ACCE-4A26-904D-00019B285C9D\",\"1564449A-CB58-41A5-955A-0001A1FB8BEA\",\"4A0FF1E0-CBFD-42EF-BD70-0001BBA0781E\",\"98161929-107C-4D1A-BBF5-0001CE2D978D\",\"A76F5684-DBD6-4415-A0A7-0001D94C139B\",\"29FE9E1E-ED37-44A6-993C-0001E2F97177\",\"7D04C568-FD9F-4F03-ACBF-00021358547F\",\"2E9412E6-521C-4799-AC22-000220FA123E\",\"FC8001A2-3A58-484C-A2F2-000232B10D25\",\"07745ECB-DAAC-497E-8F1D-0002421AFA77\",\"F59C1226-79C1-4C12-BDBB-0002442193FC\",\"8E0038B6-2ECD-42CA-9AEE-00024EEFD230\",\"9B034C97-EC82-425C-B0AF-00025EF34C19\",\"F523569C-FDEE-42A7-AF19-000262C9CAFA\",\"F5079E21-490C-4A3C-96B2-0002962E8870\",\"2956AC84-CE82-4950-9E7D-0002C790F211\",\"76EA1D15-1FDF-4318-A0EE-0002D14E5820\",\"3A5D1B26-6E9F-426B-8326-0002FE3EC9C9\",\"7363062B-F1D3-42C7-BE6B-0003126488D9\",\"C9B0EF94-5E07-4396-ACA2-00031BB939E0\",\"41361016-64E4-48DF-BDC7-00032C0F80EF\",\"0139A822-C0C3-47CB-BCC7-000332C5BF6E\",\"65489F83-CAC6-4893-A42F-000338850447\",\"4A85E78F-36F7-4E81-A824-00035BA23FC0\",\"A47A224E-5E79-4EE8-B78C-0003801EF646\",\"49021003-26FB-43F6-985D-0003889908CC\",\"BE914971-B251-4DBE-BB5E-0003C0FECB23\",\"347E9791-8E39-4C55-908D-0003CEA2A8F4\",\"31808974-BDF9-4441-BDEE-0003E4E7AD21\",\"99EA25F2-4B9F-421F-99D9-0003F301B65C\",\"114CDD28-87DA-4F31-9642-0004461C7210\",\"8354832B-F2CD-4332-BC05-000454F144D4\",\"8FF2A308-19AB-4782-B01E-00048E78BB91\",\"8232B4C6-B8FF-4A5A-97C1-0004AC2CAB8A\",\"383BFA9D-B551-466E-BAB3-0004C62C760F\",\"20A6F76D-B9CF-4E07-997D-0004C7DF1CE8\",\"BBA32A6C-04B5-4EB6-9D1E-0004D6540667\",\"75DD633E-F17E-4FD4-A99A-0004E7C94E8D\",\"1794546C-2251-43F5-B16C-0004FC4C72F9\",\"07A5A99A-9449-4C29-AC20-00050AB28345\",\"9B8C97D9-B495-4029-B120-000512FDC6DB\",\"6AFD4120-801B-42A3-8EAE-00052FA4C82A\",\"C1B863B2-29CF-4FF7-8D5A-00053C013423\",\"998A0E76-03CA-4179-8D48-000544BB88F4\",\"7E157CAA-1885-4F21-989A-00054E3BB8F7\",\"FBDA4E29-AC54-4EA8-8435-00054F36B42C\",\"21DB193A-64C1-47FF-BCC6-0005E2215556\",\"A144DC2C-88A0-4664-8C39-0005E275EBD2\",\"67B5086D-1BA3-4174-9158-0005EB0BE31D\",\"272C2E87-5DDF-467E-B5DD-00062985383B\",\"65C7D969-3F7F-437B-B8F0-0006565B2696\",\"F2D8D432-405A-4E9E-8196-000661DF1CD5\",\"473F5B03-C2B7-4506-85DD-0006779375CB\",\"0AB6B46F-36DE-48CB-B481-0006B900F387\",\"F9E72217-9344-43C7-9839-0006C6E45FDA\",\"83CDEF86-1ACA-4065-A3F9-0006D1217FE7\",\"352ABA28-189F-4175-A39B-0006E0E43A07\",\"4D1C230E-4130-4D7C-B95F-0006EA69025B\",\"FF5F364E-DA2C-4DDB-855F-0006EEB3FC33\",\"10C38ECF-3A40-457D-B55E-0006F11517BC\",\"4A42A7AD-20D8-449D-BE93-000701C6AFE2\",\"B318B63A-F7D5-4A68-8C1B-000702DED7DB\",\"F004A4BB-CCA1-4207-A7B6-00072C96C549\",\"BEA97ECF-69D3-4C82-81EE-00073300DA2E\",\"B3F43559-F46A-4566-9163-000742F473B3\",\"70D74E56-6933-442D-8C41-00075CABF711\",\"A1EBC693-F19E-4FC4-8CE0-00075CCA54A2\",\"7C5BDA03-4C15-4FBD-8B50-000776B7B244\",\"11013D24-3955-47EA-85C1-000781DC5D98\",\"01A8F028-4AA9-4DE7-9314-0007A6318155\",\"DB628BA4-8626-4EEA-A08F-0007ABA83034\",\"19BF3BB5-7BBF-4EEA-8BC4-0007B27C7E7F\",\"70D6BAFE-1CD9-428A-B7EB-0007B82CD13E\",\"06FC5FB0-DAB0-4E2E-921E-0007CD7AC013\",\"2BABCFE5-2ACE-43B9-9AFA-000807366388\",\"7A7EC21D-4DE1-4FC9-B681-000814396A7C\",\"D6788D5E-5F60-4B0C-8651-000814B23EE6\",\"7BB2042D-1CD1-44E9-A29F-00082051286F\",\"2763C579-67F9-43B9-989E-00084A50F45F\",\"136B8F69-831B-4B99-98D8-00084E0DE950\",\"4C79AFF2-66B4-4A3E-98DC-000894160F27\",\"F7BA3AD0-7AFC-4D4B-91AD-0008CE353543\",\"7303FA3D-A1CA-46A5-9ED1-00090F9DFF53\",\"F3402662-03A7-451A-9768-000923DB1406\",\"ED75C429-BF16-4DF7-BE96-000929D7AC08\",\"647EC7E3-6B1F-4DE9-9949-00095605D711\",\"CCB1AB5A-F0E0-4EA6-BE54-00097A3AC9D6\",\"10BD5221-99F0-41BA-B760-00099DC5085E\",\"153A2647-E3C3-48A2-8B07-0009A0769BF4\",\"60F3D508-6CF5-453D-89BD-0009A786B3DD\",\"6B775834-2732-4593-A880-0009AE9BA501\",\"7C2AD02C-D196-4483-B971-0009B1E12D75\",\"7A5EEAC1-2B39-4152-8D91-0009C26259D0\",\"FEB55D71-44F1-470F-91A6-0009D82DB3A6\",\"5F34076E-78E9-4204-8A9B-0009E63F94B2\",\"952D2BC5-D15A-4D7D-86CC-0009EDCC8046\",\"0C3876BF-4640-48DB-9E07-0009F49D39C1\",\"C501C8FC-CCF4-4B62-A68B-000A13DA7C11\",\"860434DF-5712-4CC2-8620-000A317AB414\",\"AD5BC7B1-63D7-4968-B5BF-000A3ABAE007\",\"93573F7D-537A-487B-9F99-000A5060B1A8\",\"FE69D26D-F09B-486F-ACB2-000A552FE397\",\"3FEC10B4-F313-4CEA-B5F3-000A5CB6434E\",\"1243157E-8D79-494C-ABA2-000A6078986E\",\"EFFF654C-1ABC-4358-9C34-000A769E6927\",\"C7FB9B90-ED1C-4641-8886-000A7FC33A38\",\"28815054-A276-4767-A5C9-000A95504F84\",\"4D9E2169-D680-4605-9D3B-000AF9CBE51C\",\"E3C4CFAE-42A1-486D-BCAB-000B2AEB3D2B\",\"87355F1E-7B8C-4FB3-9C96-000B340E4E90\",\"C3C292AB-D4DA-44EA-B8B9-000B394F16EE\",\"34AF79BE-24FB-4AFA-8E1A-000B61BDE723\",\"F4A79677-9572-4846-90CB-000B64CFEC2C\",\"BC3D5127-5443-482E-B7BB-000B6A42F645\",\"020D6629-7194-44FC-8DD2-000B6D92D959\",\"68C2C37E-6584-4552-AD42-000B7732A806\",\"552CAC24-D4D9-4765-9D74-000B7872B93A\",\"96846306-E577-4904-96B3-000BA4DC85A2\",\"46C17D16-B3E0-413D-9391-000BB3A30D23\",\"16464911-7168-4768-A7BD-000BBCF142ED\",\"BA44B9C6-46B8-4627-9C07-000BD6E08AEB\",\"1CB5FA09-54DE-4DD0-8AD1-000C08ECFF4A\",\"231D4B7D-1EC6-4272-BB50-000C186363B8\",\"668B2A8E-9E7D-49C6-B717-000C200BF077\",\"643A0B35-9E79-4E2B-AC11-000C24034FA9\",\"E1309836-DE69-4FF4-A8F6-000C31D34BBE\",\"F87D4086-8EBC-4EB0-891C-000C48E19682\",\"C73BD18A-FF93-4826-8677-000C4902E516\",\"DA344B4A-7254-4EE0-8BBB-000C4AED900F\",\"CCADA05D-22B5-423A-A839-000C5B552AE6\",\"5B7B354C-4234-4801-92B8-000C7050B0F2\",\"2AC328FA-8A4B-4C45-8BEF-000CA4C4CA48\",\"DFE129BB-B168-4829-807F-000CC6AF85F3\",\"22C72279-5489-4C8C-B0B2-000CD38AE95F\",\"476CF1E3-5D61-4A8A-AF70-000D3532C9FC\",\"3C8966EC-6AED-41D7-99D8-000D38DC2049\",\"4A3AEE26-5E91-4D6A-B908-000D3B321E13\",\"52FF13CA-4B70-408E-866C-000D429F193B\",\"6912F11A-D76D-4203-900E-000D7C2E5DAE\",\"3940E136-D719-4B89-887D-000D888A15F6\",\"60BA97E5-9E4A-4D69-8C68-000D8CE56DA4\",\"C2996E0B-5897-403A-BC8E-000DA391B7FA\",\"3B6EEC5E-A34D-4653-BE5E-000DB65063FC\",\"639C64C1-E25B-4A0B-833A-000DB894C283\",\"71C96C02-35A6-4A43-A04E-000DEDD154D9\",\"3F1B69AF-AAE4-486E-8102-000E169A4DAE\",\"7BDD6A7A-1157-4887-B397-000E187B7387\",\"F8EBE133-992C-4376-8C54-000E21364C84\",\"83C10FE0-D513-436D-961F-000E286148E8\",\"446EA11D-E130-4BB0-B134-000E3B6DB8ED\",\"94561431-54C3-4706-8EAE-000E49B2D4FA\",\"13B4E5C5-9807-482D-9D06-000E55365F70\",\"DA0D2F6A-8CF4-4157-86AE-000E7FA7E362\",\"A2E19E6C-1FD9-4BD2-9EA5-000E9FDC8BEC\",\"C9C8C345-B31C-4B5F-B834-000EA1BA2620\",\"25B7961B-FDD8-4B91-A266-000EA8B55EBF\",\"4F859AB7-7767-4E86-BB61-000EC1B5DB70\",\"64D612AA-16EC-45F3-944C-000ECE43111B\",\"C25662E9-8242-40A1-BDEB-000EDF4AAA6E\",\"8AD29D8F-6EDF-48E2-8B76-000EE510568E\",\"727E78A9-E0FF-4CD4-9E0A-000EEEEB41DF\",\"192C648F-56EB-4691-9B67-000EFC34443B\",\"23D7D860-17A2-473B-9077-000EFCABAF3C\",\"AD5D4E8E-B583-446A-9ECC-000F02633239\",\"1F98A709-1F2C-4184-A2FB-000F1B709BFC\",\"56FD8056-091C-4943-A769-000F27B8AC0F\",\"AEF5BBE9-0A33-4E1D-864A-000F53D78F3D\",\"2F1D5B15-2B0B-4DC7-9BF2-000F6EBF70E1\",\"BCD07C1E-17BE-4DF1-BA02-000F7A7C8A4E\",\"C1CC1D19-3449-4841-88A8-000FC118A0B8\",\"54B6A547-9A68-41ED-A34D-000FC5EF0182\",\"B13BC152-7AC6-47D1-94C9-000FD038868D\",\"1F773C1E-17F2-4075-B419-000FE007A5B3\",\"E6D63C47-DB6A-41E1-A891-001007B02243\",\"0C0D5DAC-A036-485A-90A2-00103501607C\",\"3CC6F639-B920-4707-8650-001041AFF49F\",\"9DDCA825-3E53-4B50-A7EB-00106CF086FF\",\"A650A148-5565-4FE9-BA4F-00108C8B02BB\",\"84308675-BC8F-471F-A678-0010AA639307\",\"118A6A35-BA77-4F82-A12F-0010C93D20A9\",\"470BA9A6-DC0F-4940-8A07-0010D055136C\",\"F92E60BA-0A53-430E-95FC-0010E22178AE\"]";
            var userIds = JsonConvert.DeserializeObject<List<string>>(userIdStr);

            string url = "/tpc/Circle/JoinCircleTestr2";
            foreach (var userId in userIds)
            {
                 var s= Get($"{url}?userId={userId}&circleId={circleId}");
            }
        }

        public static void MakeTopic()
        {
            var data = GetData();
            var realAttach = data.Select(s => s.Attachment).ToList().Distinct().ToList();
            
            string url = "/tpc/Topic/Add";
            foreach (var item in data)
            {
                Post(url, item);
            }
        }


        public static string Get(string url)
        {
            var httpClientHandler = new HttpClientHandler();
            httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, error) => true;

            using HttpClient http = new HttpClient(httpClientHandler);
            http.BaseAddress = new Uri(baseUrl);
            http.DefaultRequestHeaders.Add("cookie", cookie);

            var result = http.GetAsync(url);
            var msg = result.Result.Content.ReadAsStringAsync().Result;
            return msg;
        }

        public static string Post<T>(string url, T data)
        {
            var httpClientHandler = new HttpClientHandler();
            httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, error) => true;

            using HttpClient http = new HttpClient(httpClientHandler);
            http.BaseAddress = new Uri(baseUrl);
            http.DefaultRequestHeaders.Add("cookie", cookie);


            var str = JsonConvert.SerializeObject(data);
            var content = new StringContent(str, Encoding.Default, "application/json");
            SetCookie(content);


            var result = http.PostAsync(url, content);
            var msg = result.Result.Content.ReadAsStringAsync().Result;
            return msg;
        }

        private static void SetCookie(HttpContent content)
        {
            var random = new Random();
            if (content.Headers.Contains("cookie"))
            {
                content.Headers.Remove("cookie");
            }
            content.Headers.Add("cookie", Cookies[random.Next(0, Cookies.Length)]);
        }

        public static List<TopicAddDto> GetData()
        {
            List<TopicAddDto> data = new List<TopicAddDto>();

            Random random = new Random(DateTime.Now.Millisecond);

            for (int i = 0; i < 20; i++)
            {
                var circleIdRand = random.Next(0, CircleIds.Length);
                var schoolRand = random.Next(0, Schools.Length);

                List<int> tags = new List<int>();
                var tagsRand = random.Next(1, 3);
                for (int j = 0; j < tagsRand; j++)
                {
                    var tag = Tags[random.Next(0, Tags.Length)];
                    while (tags.Contains(tag))
                    {
                        tag = Tags[random.Next(0, 4)];
                    }
                    tags.Add(tag);
                }

                List<ImageDto> images = new List<ImageDto>();
                var randImg = random.Next(0, 9);
                for (int j = 0; j < randImg; j++)
                {
                    var url = Images[random.Next(0, Images.Length)];
                    images.Add(new ImageDto()
                    {
                        Url = url,
                        Sort = j
                    });
                }
                data.Add(new TopicAddDto()
                {
                    CircleId = CircleIds[circleIdRand],
                    Content = Schools[schoolRand] + Questions[random.Next(0, Questions.Length)],
                    IsOpen = (circleIdRand + schoolRand) % 2 == 0,
                    IsQA = random.Next(0, 1) == 1,
                    Tags = tags,
                    Images = images,
                    Attachment = Attachments[random.Next(0, Attachments.Length)]
                });
            }

            return data;
        }

        public static Guid[] CircleIds = {
            Guid.Parse("7EBC1839-71B0-451A-8797-38F29B70B24D"),
            Guid.Parse("14178988-C5FB-4C9B-9981-48DD23DBBECF"),
            Guid.Parse("C5706E87-CEFE-40F1-8052-4B5FFBF586AE"),
        };

        public static string[] Schools = {
            "凤凰城中英文学校",
            "白云区景泰中学",
            "外语外贸大学附设增城实验学校",
            "越秀区育才实验学校",
            "华南师范大学附属中学新世界学校",
            "广东外语外贸大学附设增城实验学校",
        };

        public static string[] Users = { };

        public static int[] Tags = { 4, 5, 6, 8 };
        public static string[] Questions = {
            "怎么样",
            "好用吗",
            "好吗",
            "可以吗",
            "挺好",
            "真不错",
        };
        public static string[] Images = {
            "https://cos.sxkid.com/images/user/0f56eba9-8778-4b6b-99e4-b16a0879785a/adbbc07e-5cea-4905-9369-77f0cee52b54_s.jpg",
            "https://file.sxkid.com/images/user/E51DD163-2245-4D65-A881-5D5D37C9F674.jpg",
            "https://cdn.sxkid.com/images/user/b6686033-5099-4b7b-afc1-00004fa45e99/1f78cb22-d8d8-4800-ae15-09ff164fbfa0.jpg",
            "https://file.sxkid.com/images/user/FAE26C76-6099-48A8-A245-2706371E3B76.jpg",
            "https://file.sxkid.com/images/user/12A5DDC0-D8BC-4795-8A47-3919977BE2A1.jpg",
            "https://file.sxkid.com/images/user/3A260E5D-A6A4-464A-81EF-D7164AFFF811.jpg",
            "https://cdn.sxkid.com/images/user/97d3ae31-0427-45d8-8da1-000111c45c75/c93090a8-6620-434d-a712-5622e9f41d6d.jpg",

            "https://cos.sxkid.com/images/topiccircle//topicImage/f1663a6f-1d4f-41ba-baf1-d946c2127d21.jpg",
            "https://cos.sxkid.com/images/topiccircle//topicImage/4d76e82d-61b7-42c9-804f-18efa0292a51.jpg",
            "https://cos.sxkid.com/images/topiccircle//topicImage/a78cc8a5-32aa-402d-a6ea-182ade18ed46.jpg",
            "https://cos.sxkid.com/images/topiccircle//topicImage/a033945c-7c95-4c56-bd4c-f0decf3f134f.jpg",
            "https://cos.sxkid.com/images/topiccircle//topicImage/db37acb1-856e-4c76-acf1-d207a251b9d8.jpg",
            "https://cos.sxkid.com/images/topiccircle//topicImage/432fba9f-e20f-4e22-8f37-f4a89bd17874.jpg",
            "https://cos.sxkid.com/images/topiccircle//topicImage/016152e3-9640-4a72-8348-1308c893d5fa.jpg",
            "https://cos.sxkid.com/images/topiccircle//topicImage/e7e00b6c-d747-414b-a0a3-6f63f6762628.png",
            "https://cos.sxkid.com/images/topiccircle//topicImage/ff84ec30-d270-4fc3-9812-671c3eef9efa.jpg",
            "https://cos.sxkid.com/images/topiccircle//topicImage/20e755a4-5ff7-4b66-947e-4cd4d81ae287.jpg",
        };


        public static AttachmentDto[] Attachments =
        {
            null, null, null,

            //类型 0 无 1 文本 2 图片 4 直播 8 文章 16 院校 32 点评 64 回答 128 外链
            new AttachmentDto(){ AttchId = null, Content = "设计团队管理：如何营造好的团队文化和氛围？",
                AttachUrl = "https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_8880242357689316707%22%7D&n_type=0&p_from=1", Type = 128},
            new AttachmentDto(){ AttchId = null, Content = "人人都在讲的互联网思维到底是什么？",
                AttachUrl = "https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_9626402851388131646%22%7D&n_type=1&p_from=4", Type = 128},

            new AttachmentDto(){ AttchId = Guid.Parse("f3a96920-d1ed-4d95-8c08-3fda20d8723e"), Content = "创建一个标题特别长的直播测试，看看会怎样",
                AttachUrl = "https://m3.sxkid.com/live/client/liveroom.html?lectureid=f3a96920-d1ed-4d95-8c08-3fda20d8723e", Type = 4},

            new AttachmentDto(){ AttchId = Guid.Parse("617bf004-0b3b-423c-84ac-829968f8bf0e"), Content = "谷歌声音设计：怎样用文案和语言去营造一个温馨的家",
                AttachUrl = "https://m3.sxkid.com/article/zncg.html", Type = 8},

            new AttachmentDto(){ AttchId = Guid.Parse("968efc8f33d3437d86248a04758aa78f"), Content = "华南师范大学附属中学 - 高中部",
                AttachUrl = "https://m3.sxkid.com/school/detail/968efc8f33d3437d86248a04758aa78f", Type = 16},

            new AttachmentDto(){ AttchId = Guid.Parse("66cddfe6-ca2e-4266-8b81-87a760078337"), Content = "回答问题也是可以的",
                AttachUrl = "https://m3.sxkid.com/comment/i6vg.html", Type = 32},

            new AttachmentDto(){ AttchId = Guid.Parse("531b60cc-daf7-4981-8a5b-8431e037aeea"), Content = "啊送达多撒多啊送达大所多奥术大师大撒多啊送达多爱仕达撒多阿萨是的爱仕达撒多爱仕达撒多爱仕达撒多啊送达多所阿达是多爱仕达撒多啊送达多爱仕达撒多爱仕达撒多爱仕达撒多爱仕达撒多爱仕达撒多阿达上档次爱仕达撒多啊送达大所多撒撒撒撒所多阿是大师大师的阿达上档次阿是大师大师的阿萨达所多",
                AttachUrl = "https://m3.sxkid.com/question/rtefc.html", Type = 64},

        };


        //public static string Get(string url)
        //{
        //    using HttpClient http = new HttpClient();
        //    http.BaseAddress = new Uri(baseUrl);
        //    http.DefaultRequestHeaders.Add("cookie", cookie);

        //    var result = http.GetAsync(url);
        //    return result.Result.Content.ReadAsStringAsync().Result;
        //}

    }
}
